<!DOCTYPE html>
<html xmlns:ui='http://java.sun.com/jsf/facelets' 
	  xmlns:h='http://java.sun.com/jsf/html'
      xmlns:f='http://java.sun.com/jsf/core' lang='en'>
<body>
<ui:composition template='snippets/template.xhtml'>
	<ui:define name='title'>Messgrössen bearbeiten</ui:define>
	<ui:define name='content'>
	<f:view>
		<h:form id="controllerMeasurand">
		<h:dataTable id="measurands" value="#{ ControllerMeasurandsBean.measurands }" var="measurand">
			<h:column>
				<h:selectBooleanCheckbox value="#{ measurand.selected }" />
			</h:column>
			
			<h:column>
			    <f:facet name="header">
			     Name
			    </f:facet>
			     <h:inputText value="#{ measurand.name }" required="true">
			     	<f:validateLength minimum='1' maximum='64' />
			     </h:inputText>
			     <h:inputHidden value="#{ measurand.oldName }">
			     	<f:validateLength minimum='1' maximum='64' />
			     </h:inputHidden>
			</h:column>
							
			<h:column rendered="#{ Helper.isAdministrator }">
			    <f:facet name="header">
			      Öffentlich
			    </f:facet>
			    <h:selectBooleanCheckbox value="#{ measurand.isPublic }" />
			</h:column>	
			
			<h:column>
				<f:facet name="header">
					Beschreibung
				</f:facet>
				<h:inputText value="#{ measurand.description }" required='true'>
					<f:validateLength minimum='1' maximum='128' />
				</h:inputText>
			</h:column>
			
			<h:column>
				<a href="controller_units.xhtml?owner=#{ measurand.owner }&#38;name=#{ measurand.name }">Einheiten anzeigen/bearbeiten</a>
			</h:column>
			<br />
		</h:dataTable>
		<br />
		<br />
		<h:commandButton id="voteLink" action="#{ ControllerMeasurandsBean.vote }" disabled="true" value="Zur Veröffentlichung vorschlagen" />
		<h:outputText value="&#160;" />
		<h:commandButton id="deleteLink" action="#{ ControllerMeasurandsBean.delete }" value="Löschen" />
		<h:outputText value="&#160;" />
		<h:commandButton id="saveButton" action="#{ ControllerMeasurandsBean.save }" value="Speichern" />

		</h:form>
	</f:view>
	</ui:define>
</ui:composition>
</body>
</html>